<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 父类
        function Person(name, age) {
            this.name = name;
            this.age = age;
        }
        Person.prototype.sayhi = function() {
            console.log('sssss');
        }

        // 继承 子类原型指向父类实例
        student.prototype = new Person('jack', 18)

        // 子类
        function student(gender) {
            this.gender = gender;
        }
        student.prototype.play = function() {
            console.log('dadada');
        }
        const s = new student('nan')
        console.log(s);
        console.log(s.gender);
        console.log(s.age, s.name);
        s.sayhi();
        student.prototype.play();
        Person.prototype.sayhi()
    </script>
</body>

</html>